render: fix arrow orientation
authorSebastian Keller <sebastian-keller@gmx.de>
Wed, 21 Jan 2015 00:14:55 +0000 (01:14 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 21 Jan 2015 00:38:51 +0000 (01:38 +0100)
The rotation code in the draw_arrow function was assuming that the arrow
would be drawn pointing upwards but it was pointing to the right
resulting in the rotated arrows pointing in the wrong direction.

The recent refactoring caused a pi/2 rotation to be lost. Rather than
adding that back somehwere (to lose it again in the future), we just
draw the arrow pointing upwards as it is expected to do with a 0 angle.

gtk/gtkcssimagebuiltin.c

index d3644962b928d336883a0d6802b73b25c6353f23..3ee9bd5c96f0a5f2e244cd1b2371debdd7ed7a74 100644 (file)
@@ -243,7 +243,6 @@ gtk_css_image_builtin_draw_arrow (GtkCssImage            *image,
       g_assert_not_reached ();
       break;
   }
-  cairo_translate (cr, size / 4.0, 0);
 
   line_width = size / 3.0 / sqrt (2);
   cairo_set_line_width (cr, line_width);
@@ -254,9 +253,9 @@ gtk_css_image_builtin_draw_arrow (GtkCssImage            *image,
                (size / (size + line_width)),
                (size / (size + line_width)));
 
-  cairo_move_to (cr, -size / 2.0, -size / 2.0);
+  cairo_move_to (cr, -size / 2.0, size / 4.0);
+  cairo_rel_line_to (cr, size / 2.0, -size / 2.0);
   cairo_rel_line_to (cr, size / 2.0, size / 2.0);
-  cairo_rel_line_to (cr, - size / 2.0, size / 2.0);
 
   gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
   cairo_stroke (cr);